<!doctype html>
<html lang="en">
  <head>
    <th:block th:include="include :: desk-header" />
  </head>

  <body>

    <div class="container-fluid">
      <div class="row">

        <div class="col-md-12">

        <form action="/user/editpwdop" method="post" id="form">
          <div class="form-group">
            <label>原密码</label>
            <input type="password" name="pwd" class="form-control" placeholder="原密码" required autofocus>
          </div>
          <div class="form-group">
            <label>新密码</label>
            <input type="password" name="newpwd" class="form-control" placeholder="新密码" required>
          </div>
          <div class="form-group">
            <label>确认码</label>
            <input type="password" name="repwd" class="form-control" placeholder="重新输入新密码" required>
          </div>
          <button type="submit" class="btn btn-primary">修改密码</button>
        </form>

        </div>

    </div>
    </div>


    <th:block th:include="include :: desk-footer" />

      <script>
        //表单提交
        $(document)
                .ajaxStart(function(){
                  $("button:submit").val("提交中...").attr("disabled", true);
                })
                .ajaxStop(function(){
                  $("button:submit").val("修改密码").attr("disabled", false);
                });

                $("form").submit(function(){
                  var self = $(this);
                  $.post(self.attr("action"), self.serialize(), success, "json");
                  return false;

                    function success(data){
                      if(0==data.code){
                        return layer.msg(data.msg, {icon: 2,shade: [0.5]});
                      }

                      layer.msg(data.msg, {icon: 1},function () {
                        parent.closeall();
                      })

                    }
                });
      </script>
  </body>
</html>
